<script type="text/javascript" src="/statics/js/jquery.lazyload.js"></script>
<!--筛选按钮开始-->
<div class="shuaixuan">
    <div class="shuaixuan1"><a href="?hot=<?=I('get.hot') == 'dw' ? 'up' : 'dw'?>">人气</a><span class="<?=I('get.hot') ? 'sxac' : ''?>"></span></div>
    <div class="shuaixuan2"><a href="?sales=<?=I('get.sales') == 'dw' ? 'up' : 'dw'?>">销量</a><span class="<?=I('get.sales') ? 'sxac' : ''?>"></span></div>
    <div class="shuaixuan3"><a href="?news=<?=I('get.news') == 'dw' ? 'up' : 'dw'?>">新品</a><span class="<?=I('get.news') ? 'sxac' : ''?>"></span></div>
    <div class="shuaixuan4"><a href="?price=<?=I('get.price') == 'dw' ? 'up' : 'dw'?>">价格</a><span class="<?=I('get.price') ? 'sxac' : ''?>"></span><span class="<?=I('get.price')=='up' ? 'pay-up2' : 'pay-up'?>"></span><span class="<?=I('get.price')=='dw' ? 'pay-down2' : 'pay-down';?>"></span></div>
</div>
<!--筛选按钮结束-->

<!--搜索按钮开始-->
<div class="nei_ss" style="background-color:#D85497">
	<div class="nei_ss-back"><a href="javascript:history.back(-1)"></a></div>
	<form action="/goods/glist" method="get">
    <div class="nei_ss-kkk"><input type="text" class="nk" name="keyword" value="<?=I('get.keyword')?>" placeholder="请输入搜索产品" />
    <span><input class="nt" type="submit" /></span></div>
	<input type="hidden" name="sek" value="<?=$sek?>" />
    </form>
    <div class="nei_ss-fl"><a href="/cate/main"></a></div>
</div>
<!--搜索按钮结束-->

<!--新品推荐开始-->
<div class="list">
  <div class="cp">
        <script type="text/javascript">  
			$(document).ready(function(){  
				var range = 50; //距下边界长度/单位px  
				var elemt = 500; //插入元素高度/单位px  
				var maxnum = 20; //设置加载最多次数  
				var num = 1;doreturn = 1;page = 0;
				var totalheight = 0;  
				var main = $("#content"); //主体元素  
				$(window).scroll(function(){  
					var srollPos = $(window).scrollTop(); //滚动条距顶部距离(页面超出窗口的高度)  
					totalheight = parseFloat($(window).height()) + parseFloat(srollPos);  
					if(($(document).height()-range) <= totalheight && num != maxnum && doreturn > 0) {
						doreturn = 0;$('.ajaxing').remove();
						$.get('/goods/glist',{'page':(parseInt(page)+1),'hotAjax':'1','sek':'<?=$sek?>','cid':'<?=I("get.cid") ?: ''?>','plv':'<?=I("get.plv")?>','new':'<?=I("get.news")?>','hot':'<?=I("get.hot")?>','sales':'<?=I("get.sales")?>','price':'<?=I("get.price")?>','keyword':'<?=I("get.keyword")?>'},function(data){
							page = data.page;
							main.append(data.data);  
							num++;doreturn = data.code;
							$(".lazys").lazyload();
						},'json');
					}  
				});  
				$('#content').append('<center class="ajaxing" style="margin-top:58px"><img src="/statics/images/ajaxing.gif" /></center>');
				$.get('/goods/glist',{'page':(parseInt(page)+1),'hotAjax':'1','oem':'<?=I('get.oem') ?: 0?>','sek':'<?=$sek?>','cid':'<?=I("get.cid") ?: ''?>','plv':'<?=I("get.plv")?>','new':'<?=I("get.news")?>','hot':'<?=I("get.hot")?>','sales':'<?=I("get.sales")?>','price':'<?=I("get.price")?>','keyword':'<?=I("get.keyword")?>'},function(data){
					$('.ajaxing').remove();
					page = data.page;
					main.append(data.data);
					if(data.code == '0'){
						main.append('<center style="margin-top:80px"><img src="/statics/images/search-no.png" width="60%"><br />抱歉，没有您要的相关商品<br>试试别的关键词吧~</center>');
					}
					num++;doreturn = 1; 
					$(".lazys").lazyload();
				},'json');
			});  
		</script>

    <div id="content" class="cp"></div>
    <br><br><br>
  </div>
</div>
<!--新品推荐结束-->
<div class="fiex nav"> <a class="icon-shouye" href="/index/index/sek/<?=$sek?>"><br />
  首页</a> <a class="icon-fenlei fiex_on" href="/cate/main/sek/<?=$sek?>"><br />
  分类</a> <a class="icon-gouwu" href="/cart/index/sek/<?=$sek?>"><span id="cartSum"></span><br />
  购物车</a> <a class="icon-geren" href="/index/user/sek/<?=$sek?>"><br />
  用户中心</a> </div>

<div class="che-true">
	<p>已加入购物车</p>
</div>

<script type="text/javascript">
	$(function(){
		cartSum();
	});
	function putCart(_this){
		var Id = $(_this).parent().siblings('input[type="hidden"]').val();
		$.get('/cart/putCart',{'goods_id':Id,'nums':1,'sek':'<?=$sek?>'},function(data){
			if(data.code == '1'){
				$('.che-true').css('display','block').addClass('che-true2');
				setTimeout(time,2500);
				function time(){
					$('.che-true').css('display','none');
					cartSum();
				}
			}else{
				alert(data.msg);
			}
		},'json');
	}
</script>